MySQL Programming: Questions and Answers by George Duckett

MySQL Programming: Questions and Answers by George Duckett

Author:George Duckett [Duckett, George]
Language: eng
Format: epub
Tags: MySQL Programming
Publisher: George Duckett
Published: 2016-04-11T22:00:00+00:00


* * *

Answer by d-_-b

I found this to be a good solution for the most part:

SELECT * FROM table ORDER BY ISNULL(field), field ASC;

* * *

Tags: sql-order-by (Prev Q) (Next Q), order (Prev Q) (Next Q)

* * *

Q: MYSQL - ORDER BY & LIMIT

Tags: sql-order-by (Prev Q) (Next Q)

I have a query that looks like this:

SELECT article FROM table1 ORDER BY publish_date LIMIT 20

How does ORDER BY work? Will it order all records, then get the first 20, or will it get 20 records and order them by the publish_date field?

If it's the last one, you're not guaranteed to really get the most recent 20 articles.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.